//
//  XLProblemHeaderView.m
//  industry
//
//  Created by xl on 2021/1/8.
//  Copyright © 2021 Haier. All rights reserved.
//

#import "XLProblemHeaderView.h"

@interface XLProblemHeaderView ()

@property (nonatomic, strong) XLImageView *bgIG;
@property (nonatomic, strong) XLLabel *titleLB;

@end
@implementation XLProblemHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.bgIG];
        [_bgIG addSubview:self.titleLB];
        [_bgIG addSubview:self.backBtn];
        
        [_bgIG mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.top.right.equalTo(self);
             make.height.mas_equalTo(SCREEN_WIDTH * 262/375.0);
        }];
        
        [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bgIG).offset(35);
            make.top.equalTo(self.bgIG).offset(37 + STATUSBAR_HEIGHT);
        }];
        
        [_backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.bgIG).offset(-36);
            make.centerY.equalTo(self.titleLB);
            make.size.mas_equalTo(CGSizeMake(24, 24));
        }];
    }
    return self;
}
#pragma mark - setter/getter
- (XLImageView *)bgIG {
    if (!_bgIG) {
        _bgIG = [XLImageView new];
        _bgIG.userInteractionEnabled = YES;
        _bgIG.image = XLIMAGE(@"yhbg");
    }
    return _bgIG;
}

- (XLLabel *)titleLB {
    if (!_titleLB) {
        _titleLB = [XLLabel new];
        _titleLB.font = [UIFont fontOfPingFangSCSemiboldWithSize:22];
        _titleLB.textColor = [UIColor whiteColor];
        _titleLB.text = @"常见问题";
    }
    return _titleLB;
}

- (XLButton *)backBtn {
    if (!_backBtn) {
        _backBtn = [XLButton new];
        [_backBtn setCurrentButtonHotSize:CGSizeMake(44, 44)];
        [_backBtn setImage:XLIMAGE(@"bsfh") forState:UIControlStateNormal];
    }
    return _backBtn;
}
@end
